﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace supermarket
{
    public partial class supmain : Form
    {
        string us;
        string role;
        string tip;
        public supmain ( string username, string role, string tip )
        {
            InitializeComponent();
            us = username;
            this.role = role;
            this.tip = tip;
        }


        private void 礼品管理ToolStripMenuItem_Click ( object sender, EventArgs e )
        {
            supgiftmanage frm = new supgiftmanage();
            frm.ShowDialog();
        }

        private void toolStripMenuItem2_Click_1 ( object sender, EventArgs e )
        {
            supintegralexchange supintegralexchange = new supintegralexchange(role);
            supintegralexchange.ShowDialog();
        }



        private void toolStripStatusLabel1_Click ( object sender, EventArgs e )
        {

        }

        private void toolStripStatusLabel2_Click ( object sender, EventArgs e )
        {

        }

        private void timetool_Click ( object sender, EventArgs e )
        {

        }

        private void supmain_Load ( object sender, EventArgs e )
        {
            tooluser.Text = us;
            timer1.Enabled = true;

            switch (role)
            {
                case "Admin":
                    店铺管理ToolStripMenuItem.Visible = true;
                    会员消费ToolStripMenuItem.Visible = false;
                    数据安全ToolStripMenuItem.Visible = true;
                    数据统计ToolStripMenuItem.Visible = false;
                    toolStripMenuItem1.Visible = true;
                    break;
                case "Manager": // 经理界面
                    店铺管理ToolStripMenuItem.Visible = false;
                    会员消费ToolStripMenuItem.Visible = false;
                    数据安全ToolStripMenuItem.Visible = false;
                    数据统计ToolStripMenuItem.Visible = true;
                    toolStripMenuItem1.Visible = true;
                    break;
                case "Cashier":
                    店铺管理ToolStripMenuItem.Visible = false;
                    会员消费ToolStripMenuItem.Visible = true;
                    数据安全ToolStripMenuItem.Visible = false;
                    数据统计ToolStripMenuItem.Visible = false;
                    toolStripMenuItem1.Visible = false;
                    break;
                default:
                    break;
            }
            this.WindowState = FormWindowState.Maximized;
            lblShow1.Left = (this.ClientSize.Width - lblShow1.Width) / 4;
            lblShow1.Top = (this.ClientSize.Height - lblShow1.Height) / 3;
            lblShow1.Text = $"您好 {us} 超市会员管理系统欢迎您!";
        }

        private void timer1_Tick ( object sender, EventArgs e )
        {
            timetool.Text = DateTime.Now.ToString();
        }


        private void 店铺管理ToolStripMenuItem_Click ( object sender, EventArgs e )
        {
            shopmanage shopmanage = new shopmanage();
            shopmanage.ShowDialog();
        }

        private void 会员管理ToolStripMenuItem_Click ( object sender, EventArgs e )
        {
        }

        private void toolStripMenuItem1_Click ( object sender, EventArgs e )
        {
            if (role.ToLower() == "admin")
            {
                employeeinformation employeeinformation = new employeeinformation();
                employeeinformation.ShowDialog();
            }
            else
            {
                employeeinformationdz employeeinformationNew = new employeeinformationdz(tip);
                employeeinformationNew.ShowDialog();
            }
        }

        private void 数据备份ToolStripMenuItem_Click ( object sender, EventArgs e )
        {
            dataManage dataManage = new dataManage();
            dataManage.ShowDialog();
        }

        private void 退出ToolStripMenuItem_Click ( object sender, EventArgs e )
        {
            Application.Exit();
        }

        private void 数据统计ToolStripMenuItem_Click ( object sender, EventArgs e )
        {
            shopTJ shopTJ = new shopTJ(tip);
            shopTJ.ShowDialog();
        }

        private void 会员消费ToolStripMenuItem_Click ( object sender, EventArgs e )
        {
            memberconsumption memberconsumption = new memberconsumption();
            memberconsumption.ShowDialog();
        }

        private void 管理员修改手机号ToolStripMenuItem_Click ( object sender, EventArgs e )
        {
            supupdatenumber frm = new supupdatenumber();
            frm.ShowDialog();
        }

        private void 新建会员ToolStripMenuItem_Click ( object sender, EventArgs e )
        {
            supnewuser frm = new supnewuser();
            frm.ShowDialog();
        }

        private void 删除会员ToolStripMenuItem_Click ( object sender, EventArgs e )
        {
            supdeleteuser frm = new supdeleteuser();
            frm.ShowDialog();
        }

        private void 查询会员ToolStripMenuItem_Click ( object sender, EventArgs e )
        {
            supselectuser frm = new supselectuser();
            frm.ShowDialog();
        }
    }
}
